package com.quikin.persistence.jpa.entity.aa;

import java.io.Serializable;

import javax.persistence.*;
import java.sql.Timestamp;


/**
 * The persistent class for the AUTHENTICATION_INFO database table.
 * 
 */
@Entity
@Table(name="AUTHENTICATION_INFO")
@NamedQueries({
        @NamedQuery(name="AuthenticationInfo.getByLoginId", query="select a from AuthenticationInfo a where a.loginId=:loginId"),
})
public class AuthenticationInfo implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="PROFILE_ID")
	private String profileId;

	@Column(name="LAST_LOGIN_TIME")
	private Timestamp lastLoginTime;

	@Column(name="LOGIN_ID")
	private String loginId;

	private String password;

	@Column(name="PWD_ERR_CNT")
	private Integer pwdErrCnt;

	private Integer status;

	//bi-directional one-to-one association to UserProfile
	@OneToOne
	@JoinColumn(name="PROFILE_ID")
	private UserProfile userProfile;

    public AuthenticationInfo() {
    }

	public String getProfileId() {
		return this.profileId;
	}

	public void setProfileId(String profileId) {
		this.profileId = profileId;
	}

	public Timestamp getLastLoginTime() {
		return this.lastLoginTime;
	}

	public void setLastLoginTime(Timestamp lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	public String getLoginId() {
		return this.loginId;
	}

	public void setLoginId(String loginId) {
		this.loginId = loginId;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public Integer getPwdErrCnt() {
		return this.pwdErrCnt;
	}

	public void setPwdErrCnt(Integer pwdErrCnt) {
		this.pwdErrCnt = pwdErrCnt;
	}

	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public UserProfile getUserProfile() {
		return this.userProfile;
	}

	public void setUserProfile(UserProfile userProfile) {
		this.userProfile = userProfile;
	}
	
	public boolean isActive() {
	    if (this.getStatus() == null) {
	        return false;
	    }
	    return this.getStatus().intValue() == 1;
	}
}